import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HealthRecordVO, HealthRecordForm, HealthRecordQuery } from '@/api/basicPublic/patientInfo/healthRecord/HealthRecordTypes';

/**
 * 查询患者基本信息列表
 * @param query
 * @returns {*}
 */

export const listPatientInfo = (query?: HealthRecordQuery): AxiosPromise<HealthRecordVO[]> => {
  return request({
    url: '/basicPublic/patientInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询患者基本信息详细
 * @param id
 */
export const getPatientInfo = (id: string | number): AxiosPromise<HealthRecordVO> => {
  return request({
    url: '/basicPublic/patientInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增患者基本信息
 * @param data
 */
export const addPatientInfo = (data: HealthRecordForm) => {
  return request({
    url: '/basicPublic/patientInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改患者基本信息
 * @param data
 */
export const updatePatientInfo = (data: HealthRecordForm) => {
  return request({
    url: '/basicPublic/patientInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除患者基本信息
 * @param id
 */
export const delPatientInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/basicPublic/patientInfo/' + id,
    method: 'delete'
  });
};
